function formInitFunc(){
    
    

    var cmsModelId =  $("input[name=CMSMODELID]").val();
	//隐藏审批信息
	$("#ActionsoftHistoryOpinionList").hide();
	//显示附件问题 判断附件存在与否 确定是否显示下载附件按钮
	var attfile =  $("input[name=ATTFILE]").val();
	//alert($("#awsuiFile_FILES").find("tbody").find("tr").length);
	if(attfile == null || attfile == '' || attfile == 'undefined'){
		$(".downloadfilebtn").hide();
	}else{
		$(".downloadfilebtn").show();
	}
	
	//给下载附件按钮绑定事件
	$(".downloadfilebtn").click(function(){
	//渲染附件popbox框
		$("#files_popbox").dialog({
		        target:$(this),
		        width:500,
		        height:300
	     });
	});
	
	
	//给下载正文按钮绑定事件
	$(".zwfilebtn").click(function(){
		var sid=$("#sid").val();
		var processInstId=$("#processInstId").val();
		var fileName="ZW.doc";
		var params={processInstId:processInstId,fileName:fileName};
	    var url = './jd?sid=' + sid + '&cmd=com.actionsoft.apps.formui.iweboffice_select_formfile';
		awsui.ajax.post(url, params, function(responseObject) {
			if(responseObject['result'] == 'ok'){
				    var downLondUrl=responseObject['data']['url'];
				 	//window.location.href=downLondUrl;
					window.open(downLondUrl);
			}else{
				$.simpleAlert(responseObject['msg'], responseObject['result']);
			}
		}, 'json');
	});
	
	//根据CMS栏目扩展检查是否有权限下载正文
	var isShow = isShowDownLoadZw(cmsModelId);
	if("1" == isShow){//允许显示
		$("#showzwfile").show();
	}else{//不显示
	    $("#showzwfile").hide();
	}
	
	
	

	try{
	    WebOffice.ShowTitleBar(false);
		WebOffice.ShowMenuBar(false);
		WebOffice.ShowToolBars(false);
	}catch(e){
              
	}
	
	
	
				
}



function isShowDownLoadZw(modelid){
	var sid=$("#sid").val();
    var result = "";
    awsui.ajax.request({
			url : "./jd",
			method : "POST",
			async:false,
			data : {sid:sid, 
			modelid:modelid,
			cmd:"com.whccb.apps.office.document.check_download_zw_permi"
		},
		ok : function(r) {
			result = r.data;
		},
		err:function(r){
			debugger;
		}
	});
	return result;
}



function showPDFDive() {
	var sid=$("#sid").val();
    $('div[name=fullscreenWrap]').show();
	var pdfUrl = $("input[name=PDFURL]").val();
	var url = "./w?sid="+sid+"&"+pdfUrl; 
	$('div[name=previewpanel]').empty();
	$('div[name=previewpanel]').append("<iframe class='previewfrm' name='previewfrm' style='width:100%;height:100%'></iframe>");
	$('*[name=previewfrm]').attr("src", url);
}


